package com.yenlien.traceyun.business.dao;

import com.yenlien.traceyun.business.entity.Product;
import com.yenlien.traceyun.webase.dao.BaseJpaDao;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by LiuSha on 2020/7/24.
 */
public interface ProductDao extends BaseJpaDao<Product> {
    Product findById(String id);

    List<Product> findByCompanyId(String companyId);

    @Query(value = " select id,company_id,createtime,img,introduce,link,quality,related_products,title,user_id from t_product where company_id=?1 and user_id=?2 and related_products=?3", nativeQuery = true)
    List<Product> findByRelated(String companyId, String userId, String relatedProducts);
}
